package com.jet.cashier.inner;

import com.jet.cashier.domain.vo.CashierOrderLastVo;
import com.jet.cashier.service.CashierOrderService;
import com.jet.core.result.ResultJson;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dcl
 * @since 2025/2/21 15:36
 */
@RestController
@RequestMapping("/inner/cashier-order")
public class InnerCashierOrderController {

    private final CashierOrderService cashierOrderService;

    public InnerCashierOrderController(CashierOrderService cashierOrderService) {
        this.cashierOrderService = cashierOrderService;
    }

    @GetMapping("/last-cashier-order")
    public ResultJson<CashierOrderLastVo> getMemberLastCashierOrder(@RequestParam long merchantNo,
                                                                    @RequestParam String memberId) {
        CashierOrderLastVo vo = cashierOrderService.findLastByMemberId(merchantNo, memberId);
        return ResultJson.ok(vo);
    }
}
